package com.smart.controller;

import com.smart.common.ResultVo;
import com.smart.entity.Goods;
import com.smart.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/admin")
public class AdminGmsController {

    @Autowired
    GoodsService goodsService;

    @GetMapping("/gms/all")
    public ResultVo GoodsAll() {
        List<Goods> goodsList = goodsService.GoodsAll();
        return ResultVo.ok().data("item", goodsList);
    }

    @GetMapping("/gms/shelf")
    public ResultVo GoodsShelf() {
        List<Goods> goodsList = goodsService.GoodsShelf();
        return ResultVo.ok().data("item", goodsList);
    }

    @GetMapping("/gms/remove")
    public ResultVo GoodsRemove() {
        List<Goods> goodsList = goodsService.GoodsRemove();
        return ResultVo.ok().data("item", goodsList);
    }

    @GetMapping("/gms/add")
    public ResultVo GoodsAdd(Goods goods) {
        goodsService.GoodsAdd(goods);
        return ResultVo.ok().data("item", "goodsList");
    }

}
